package com.example.testgit.VO;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author: lyh
 * @create: 2023/3/27 11:43
 * Description：
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageResult<T> {

    private long total;//查到多少条记录

    private long page;//当前是第几页

    private long pages;//一共有几页

    private long size;//每页展示几条记录

    private List<T> data;//data

    private JSONObject note;//一些统计数据

    public PageResult(Page page) {
        this.total = page.getTotal();
        this.page = page.getCurrent();
        this.pages = page.getPages();
        this.size = page.getSize();
        this.data = page.getRecords();
    }
}
